using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;

namespace Imagination.Physics
{
    public class MexicanJumpingConstraint : Constraint
    {
        Random rnd = new Random();
        Thing thing;
        Force jumpingForce;
        double seconds = 0;
        public MexicanJumpingConstraint(Thing thing)
        {
            this.thing = thing;
            jumpingForce = new Force(Vector3.Zero, thing);
            jumpingForce.IsTemporary = true;
        }

        public override void Update(GameTime gameTime, Thing thing)
        {
            seconds += gameTime.ElapsedGameTime.TotalSeconds;
            if (seconds >= 3)
            {
                jumpingForce.Acceleration = new Vector3(rnd.Next(200) - 100, 500, rnd.Next(200) - 100);
                thing.Forces.Add(jumpingForce);
                seconds = 0;
            }
        }
    }
}
